package com.pocket.demo.core.log;

import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;
import com.pocket.demo.core.context.RequestIdContext;

/**
 * logback 请求ID 格式转换器
 *
 * @author cookie.
 **/
public class RequestIdConverter extends ClassicConverter {
    public static String getReqId() {
        return RequestIdContext.getRequestId();
    }

    public String convert(ILoggingEvent event) {
        return getReqId();
    }
}
